home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / icons+tools / iconian / sources / emodules / mod / findfile.e < prev    next >
Text File  |  1995-12-22  |  673b  |  37 lines

  1. OPT MODULE
  2. OPT EXPORT
  3.  
  4. MODULE    'mod/filenames'
  5. MODULE    'mod/env'
  6. MODULE    'dos/dos'
  7.  
  8. PROC findfile(filename,paths)
  9.     DEF str[1000]:STRING,envstr[1000]:STRING
  10.     DEF lock
  11.     IF paths
  12.         WHILE Long(paths)
  13.             IF Char(Long(paths))="$"
  14.                 StrCopy(str,Long(paths)+1,ALL)
  15.                 IF (getenvstring(str,envstr))
  16.                     StrCopy(str,envstr,ALL)
  17.                     eaddpart(str,filename,990)
  18.                 ELSE
  19.                     StrCopy(str,'',ALL)
  20.                 ENDIF
  21.             ELSE
  22.                 StrCopy(str,Long(paths),ALL)
  23.                 eaddpart(str,filename,990)
  24.             ENDIF
  25.             IF StrLen(str)
  26.                 lock:=Lock(str,ACCESS_READ)
  27.                 IF lock
  28.                     UnLock(lock)
  29.                     StrCopy(filename,str,ALL)
  30.                     RETURN TRUE
  31.                 ENDIF
  32.             ENDIF
  33.             paths:=paths+4
  34.         ENDWHILE
  35.     ENDIF
  36. ENDPROC FALSE
  37.